<?php

class All_categories_model extends CI_Model {

    private $_table = 'all_categories';

    public function get_all_categories() {
        $query = $this->db->get($this->_table);
        return $query->result_array();
    }

    public function get_all_category_where($params = array()) {
        $where = array();
        if (!empty($params['id']))
            $where['id'] = $params['id'];
        if (!empty($params['site']))
            $where['id_site'] = $params['site'];
        
         $this->db->order_by('name','asc');
        $query = $this->db->get_where($this->_table, $where);
       
        return $query->result_array();
    }

    public function update_all_category($params = array(), $where) {
        $this->db->where('id', $where['id']);
        $this->db->update($this->_table, $params);
    }

}
